package game.gui.panelsplash;

import game.controler.ecouteurs.splashscreen.EcouteurSplashScreen;
import game.model.splashscreen.SplashScreen;
import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Gab'z
 */
public class PanelSplashScreen extends JPanel {

    private static PanelSplashScreen panelSplashScreen = null;
    private JLabel labelImage;

    private PanelSplashScreen() {
        this.setLayout(new BorderLayout());
        this.setSize(680, 520);
    }

    public static PanelSplashScreen getPanelSplashScreen() {
        if (panelSplashScreen == null) {
            panelSplashScreen = new PanelSplashScreen();
        }
        return panelSplashScreen;
    }

    public void setInventoriablePanelSplashScreen(ImageIcon imgZoom) {
        System.out.println("setPanelSplashScreen ImageIcon");
        this.removeAll();
        labelImage = new JLabel(imgZoom);
        //labelImage.setOpaque(true);
        this.add(labelImage, BorderLayout.CENTER);
        this.repaint();
        this.validate();
    }

    public void setPanelSplashScreen(SplashScreen splashScreen) {
        System.out.println("setPanelSplashScreen : id " + splashScreen.getId());
        this.removeAll();
        labelImage = new JLabel(splashScreen.getImg());
        //labelImage.setSize(680,520);
        this.add(labelImage, BorderLayout.CENTER);
        this.addMouseListener(new EcouteurSplashScreen(splashScreen));

        this.repaint();
        this.validate();
    }
}
